#! /bin/sh

# Set messages on
##set -x

# Demo for sukeycount

#-------------------------------------------------
# Create a data set with suplane:
#   32 traces
#   tracl=1-32 tracr=1-32 offset=400 ns=64 dt=4000
#   The three dipping events cross on tracl=16

# Name temp data set 1
temp1=temp1.bin

# Name temp data set 2
temp2=temp2.bin
#-------------------------------------------------

# Create temp data. Output temp1
suplane > $temp1

# Create binary cdp file. Set cdp. Output temp2.
a2b < ascii_cdp n1=1 > binary_cdp
sushw < temp1.bin key=cdp infile=binary_cdp > temp2.bin

# Print cdp values with surange and sugethw
echo " "
echo "surange:"
surange < temp2.bin
echo " "
echo "tracl/cdp from sugethw"
echo "---------"
sugethw < temp2.bin key=tracl,cdp output=geom
echo " "

# Plot temp data
suxwigb < $temp2 title="$temp" key=tracl \
          perc=100 hbox=600 wbox=400 \
          label1="Time (s)" label2="tracl" &

# Count key values
sucountkey < $temp2 key=tracl,tracr,offset,dt,cdp

# Exit politely from shell
exit

